package com.example.writting.ui.writing

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.example.writting.databinding.FragmentWritingBinding

class WritingFragment : Fragment() {

    private var _binding: FragmentWritingBinding? = null
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = FragmentWritingBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        
        // 设置输入框的初始状态
        binding.writingEditText.requestFocus()
    }

    fun setTimestamp(timestamp: String) {
        binding.writingEditText.setText(timestamp)
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
    }
} 